package manager;

import java.util.List;

import idao.IProductsDAO;
import imanager.IProductsManager;
import model.Products;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class ProductsManager implements IProductsManager {

	@Autowired
	private IProductsDAO productsDAO;

	public IProductsDAO getProductsDAO() {
		return productsDAO;
	}

	public void setProductsDAO(IProductsDAO productsDAO) {
		this.productsDAO = productsDAO;
	}

	public ProductsManager() {
		// TODO Auto-generated constructor stub
	}

	@Transactional
	public boolean insert(Products products) {
		// TODO Auto-generated method stub
		return productsDAO.insert(products);
	}

	@Transactional
	public boolean update(Products products) {
		// TODO Auto-generated method stub
		return productsDAO.update(products);
	}

	@Transactional
	public boolean delete(Products products) {
		// TODO Auto-generated method stub
		return productsDAO.delete(products);
	}

	@Transactional
	public Products getProductByID(int id) {
		// TODO Auto-generated method stub
		return productsDAO.getProductByID(id);
	}

	@Transactional
	public List<Products> getAll() {
		// TODO Auto-generated method stub
		return productsDAO.getAll();
	}

	@Override
	public List<Products> getBetween(int min, int max) {
		// TODO Auto-generated method stub
		return productsDAO.getBetween(min, max);
	}

}
